package study.nosql.redis.support.utils;

import cn.hutool.core.util.NumberUtil;

public class RedisKeys {

    public static final Long SEC = 1000L;

    public static final Long MIN = 60 * SEC;

    private static final String DELIMITER = ":";

    public static String format(String... parts) {
        if (parts == null || parts.length == 0) {
            return "";
        }
        StringBuffer sb = new StringBuffer();
        for (String part : parts) {
            sb.append(DELIMITER).append(part);
        }
        return sb.substring(1);
    }

    public static String keyOfUser(Long ubId) {
        return format("user", "info", NumberUtil.toStr(ubId));
    }
}
